load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "aggregation",
    srcs = [
        "agg_to_pb.go",
        "aggregation.go",
        "avg.go",
        "base_func.go",
        "bit_and.go",
        "bit_or.go",
        "bit_xor.go",
        "concat.go",
        "count.go",
        "descriptor.go",
        "explain.go",
        "first_row.go",
        "max_min.go",
        "sum.go",
        "util.go",
        "window_func.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/expression/aggregation",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/expression",
        "//pkg/kv",
        "//pkg/parser/ast",
        "//pkg/parser/charset",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/planner/util",
        "//pkg/sessionctx",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/variable",
        "//pkg/types",
        "//pkg/util/chunk",
        "//pkg/util/codec",
        "//pkg/util/collate",
        "//pkg/util/mathutil",
        "//pkg/util/mvmap",
        "//pkg/util/size",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_tipb//go-tipb",
    ],
)

go_test(
    name = "aggregation_test",
    timeout = "short",
    srcs = [
        "agg_to_pb_test.go",
        "aggregation_test.go",
        "base_func_test.go",
        "bench_test.go",
        "main_test.go",
        "util_test.go",
    ],
    embed = [":aggregation"],
    flaky = True,
    shard_count = 14,
    deps = [
        "//pkg/expression",
        "//pkg/kv",
        "//pkg/parser/ast",
        "//pkg/parser/mysql",
        "//pkg/sessionctx",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/variable",
        "//pkg/testkit/testsetup",
        "//pkg/types",
        "//pkg/util/chunk",
        "//pkg/util/mock",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
